
package org.upt.dcda.db;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * The persistent class for the bookreviews database table.
 * 
 */
@Entity
@Table(name = "bookreviews")
@NamedQuery(name = BookReviewEntity.VIEW_BOOK_REVIEW, query = "SELECT bookreviewm FROM BookReviewEntity bookreviewm WHERE bookreviewm.book.bookId = :bookid")
public class BookReviewEntity implements Serializable
{

	private static final long	serialVersionUID	= 1L;

	public static final String	VIEW_BOOK_REVIEW	= "view_book_review";

	private int					bookreviewId;

	private String				bookreviewContent;

	private int					bookreviewMark;

	private BookEntity			book;

	private UserEntity			user;

	public BookReviewEntity()
	{
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "bookreview_id")
	public int getBookreviewId()
	{
		return this.bookreviewId;
	}

	private void setBookreviewId(int bookreviewId)
	{
		this.bookreviewId = bookreviewId;
	}

	@Column(name = "bookreview_content")
	public String getBookreviewContent()
	{
		return this.bookreviewContent;
	}

	public void setBookreviewContent(String bookreviewContent)
	{
		this.bookreviewContent = bookreviewContent;
	}

	@Column(name = "bookreview_mark")
	public int getBookreviewMark()
	{
		return this.bookreviewMark;
	}

	public void setBookreviewMark(int bookreviewMark)
	{
		this.bookreviewMark = bookreviewMark;
	}

	// bi-directional many-to-one association to BookEntity
	@ManyToOne(cascade = CascadeType.REMOVE)
	@JoinColumn(name = "bookreview_book_id")
	public BookEntity getBook()
	{
		return this.book;
	}

	public void setBook(BookEntity book)
	{
		this.book = book;
	}

	// bi-directional many-to-one association to UserEntity
	@ManyToOne(cascade = CascadeType.REMOVE)
	@JoinColumn(name = "bookreview_user_id")
	public UserEntity getUser()
	{
		return this.user;
	}

	public void setUser(UserEntity user)
	{
		this.user = user;
	}

}
